using System.Collections;
using UnityEngine;

public class ButtonShowSkinExporterWindow : MonoBehaviour
{
	private Coroutine loadWindow;

	public void Start()
	{
	}

	public void OnClick()
	{
		if (SkinExporterWindow.instance == null)
		{
			if (loadWindow == null)
			{
				loadWindow = StartCoroutine(LoadSkinExporterWindow());
			}
		}
		else
		{
			SkinExporterWindow.instance.ShowChooseSkinWindow();
		}
	}

	private IEnumerator LoadSkinExporterWindow()
	{
		LoadingPanel.instance.ShowLoadingPanel(true);
		ResourceRequest loadPlayer = Resources.LoadAsync("Prefabs/Lobby/SkinsExporterPanel");
		yield return loadPlayer;
		GameObject tmp = Object.Instantiate(loadPlayer.asset as GameObject);
		tmp.transform.parent = controllerMenu.thisScript.parentLobbyUI.transform.parent;
		tmp.transform.localScale = Vector3.one;
		yield return null;
		tmp.GetComponent<SkinExporterWindow>().ShowChooseSkinWindow();
		LoadingPanel.instance.ShowLoadingPanel(false);
	}
}
